package com.mass.core.utils;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpSession;

import org.springframework.util.ObjectUtils;

/**
 * 
 * @ProjectName:  [demo-ht] 
 * @Package:      [com.mass.core.utils.SessionUtil.java]  
 * @ClassName:    [SessionUtil]   
 * @Description:  [session]   
 * @Author:       [张双喜]   
 * @CreateDate:   [2018年7月18日 上午10:54:18]   
 * @UpdateUser:   [zsx]   
 * @UpdateDate:   [2018年7月18日 上午10:54:18]   
 * @UpdateRemark: [说明本次修改内容] 
 * @Since         [JDK1.7]
 * @Version:      [v1.0]
 *
 */
public class SessionUtil {

	private static HttpSession session;
	
	private static Map<String, Object> map = new HashMap<String, Object>();   //定义常量验证登录
	
	public synchronized static void setHttpSession(HttpSession session){
	    SessionUtil.session = session;
	}
	public synchronized static HttpSession getHttpSession(){
		return session;
	}
	public synchronized static Map<String, Object> getMap() {
		return map;
	}
	public synchronized static Object getMap(String userName) {
		return map.get(userName);
	}
	public synchronized static void setMap(String userName,Object object) {
		Object obj = map.get(userName);
		if(ObjectUtils.isEmpty(obj)){
			map.put(userName, object);
		}
	}
}
